<?php
declare (strict_types = 1);

namespace app\command;

use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;

class Order extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('cancel')
            ->setDescription('the cancel command');
    }

    protected function execute(Input $input, Output $output)
    {
        //取消未支付的订单
        \app\admin\model\Order::where('create_time','<', time() - 900)->where('status',0)->update(['status' => -1]);
        \app\admin\model\User::where('expire_time','<',time())->update(['is_vip' => 0,'expire_time' => 0]);
        // 指令输出
        $output->writeln('cancel');
    }
}
